//
//  MGSecondFloorRefreshHeader.h
//  MGTV-iPhone
//
//  Created by Qeye Wang on 2019/3/5.
//  Copyright © 2019 hunantv. All rights reserved.
//
//  芒果二楼刷新控件

#import <MJRefresh.h>

NS_ASSUME_NONNULL_BEGIN

/** 发送alpha通知，现有接收者为HomeViewController，相应改变导航栏的透明度 */
static NSString *MGSecondFloorRefreshHeaderAlphaNotif = @"MGSecondFloorRefreshHeaderAlphaNotif";

typedef void (^MJSecondFloorPullingAlphaChangeBlock)(CGFloat alpha, BOOL anime);

@protocol SecondFloorViewProcotol <NSObject>

- (NSString *)pullingTips;
- (NSString *)moreTips;
- (BOOL)isAutoReFresh;
- (void)setIsAutoRefresh:(BOOL)isAuto;

- (void)setCloseBlock:(void(^)(void))block;
- (void)setFinishBlock:(void(^)(void))block;

@optional
/// 响应结束回调
- (void)responseSecondFloorFinishBlock;
/// 模块曝光的flag值
- (NSString *)moduleShowFlag;

@end

/** 芒果二楼刷新控件，不能继承header，因为state和pullingPercent需要自定义 */
@interface MGSecondFloorRefreshHeader : MJRefreshComponent

/** 广告视图 */
@property (strong, nonatomic) UIView<SecondFloorViewProcotol>   *SFView;
/** 提示语文本 */
@property (strong, nonatomic) UILabel   *tipsLabel;
/** 下拉刷新的触发值 */
@property (assign, nonatomic) CGFloat   refreshThreshold;
/** 进入二楼的触发值 */
@property (assign, nonatomic) CGFloat   secondFloorThreshold;
/** 进入二楼的事件处理 */
@property (copy, nonatomic) MJRefreshComponentAction secondFloorBlock;
/** 处理透明的block */
@property (copy, nonatomic) MJSecondFloorPullingAlphaChangeBlock alphaChangeBlock;

@property (assign, nonatomic) BOOL   moduleShowReport;

/** 频道ID */
@property (strong, nonatomic) NSString   *channelId;

/** 是否正在做动画 */
@property (assign, nonatomic) CGFloat   guideOffsetY;

+ (instancetype)headerWithRefreshBlock:(MJRefreshComponentAction)refreshBlock;

+ (instancetype)headerWithRefreshTarget:(id)target refreshAction:(SEL)action;

@end

NS_ASSUME_NONNULL_END
